/*
 * Copyright 2015 Diego Gómez Olvera
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.thunderdog.challegram.widget.rtl;

import android.database.DataSetObserver;
import android.os.Parcelable;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.viewpager.widget.PagerAdapter;

/**
 * PagerAdapter decorator.
 */
class PagerAdapterWrapper extends PagerAdapter {

  @NonNull
  private final PagerAdapter adapter;

  protected PagerAdapterWrapper(@NonNull PagerAdapter adapter) {
    this.adapter = adapter;
  }

  @NonNull
  public PagerAdapter getInnerAdapter() {
    return adapter;
  }

  @Override
  public int getCount() {
    return adapter.getCount();
  }

  @Override
  public boolean isViewFromObject(View view, Object object) {
    return adapter.isViewFromObject(view, object);
  }

  @Override
  public CharSequence getPageTitle(int position) {
    return adapter.getPageTitle(position);
  }

  @Override
  public float getPageWidth(int position) {
    return adapter.getPageWidth(position);
  }

  @Override
  public int getItemPosition(Object object) {
    return adapter.getItemPosition(object);
  }

  @Override
  public Object instantiateItem(ViewGroup container, int position) {
    return adapter.instantiateItem(container, position);
  }

  @Override
  public void destroyItem(ViewGroup container, int position, Object object) {
    adapter.destroyItem(container, position, object);
  }

  @Override
  public void setPrimaryItem(ViewGroup container, int position, Object object) {
    adapter.setPrimaryItem(container, position, object);
  }

  public void superNotifyDataSetChanged () {
    super.notifyDataSetChanged();
  }

  @Override
  public void notifyDataSetChanged() {
    adapter.notifyDataSetChanged();
  }

  @Override
  public void registerDataSetObserver(DataSetObserver observer) {
    adapter.registerDataSetObserver(observer);
  }

  @Override
  public void unregisterDataSetObserver(DataSetObserver observer) {
    adapter.unregisterDataSetObserver(observer);
  }

  @Override
  public Parcelable saveState() {
    return adapter.saveState();
  }

  @Override
  public void restoreState(Parcelable state, ClassLoader loader) {
    adapter.restoreState(state, loader);
  }

  @Override
  public void startUpdate(ViewGroup container) {
    adapter.startUpdate(container);
  }

  @Override
  public void finishUpdate(ViewGroup container) {
    adapter.finishUpdate(container);
  }
}